
#pragma once

#include <string>
#include <fstream>

//Loads images from the file.
class ImageLoader
{
	public:
		//Appends image content to buffer.
		//In case of error throws std::exception().
		static void AppendImage(const char *fileName, std::string &buffer)
		{
			char buf[1024];
			std::ifstream file(fileName);
			if (!file)
				throw std::runtime_error("Cannot open file");
			while (file.read(buf, sizeof(buf)).gcount() > 0)
				buffer.append(buf, file.gcount());
		}
};